package com.autumn.zero.authorization.entitys.modules;

import javax.persistence.Column;
import javax.persistence.Table;

import org.apache.ibatis.type.JdbcType;
import org.hibernate.validator.constraints.Length;

import com.autumn.common.api.application.DataValidation;
import com.autumn.constants.SettingConstants;
import com.autumn.domain.entities.AbstractDefaultEntity;
import com.autumn.domain.entities.EntityDataBean;
import com.autumn.mybatis.mapper.annotation.ColumnOrder;
import com.autumn.mybatis.mapper.annotation.ColumnType;
import com.autumn.mybatis.mapper.annotation.Index;
import com.autumn.validation.annotation.NotNullOrBlank;

/**
 * 资源模块类型
 * 
 * @author 老码农 2019-03-06 08:58:18
 */
@Table(name = SettingConstants.SYS_TABLE_PREFIX + "_res_module_type")
public class ResourcesModuleType extends AbstractDefaultEntity implements DataValidation, EntityDataBean {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4312978008653150548L;

	/**
	 * 字段 name
	 */
	public static final String FILED_NAME = "name";

	/**
	 * 最大名称长度
	 */
	public static final int MAX_NAME_LENGTH = 50;

	@NotNullOrBlank(message = "名称不能为空")
	@Length(max = MAX_NAME_LENGTH, message = "名称长度不能超过" + MAX_NAME_LENGTH + "个字。")
	@Column(name = "name", nullable = false, length = MAX_NAME_LENGTH)
	@ColumnType(jdbcType = JdbcType.VARCHAR)
	@Index(unique = true)
	@ColumnOrder(2)
	private String name;

	/**
	 * 获取资源名称
	 * 
	 * @return
	 */
	public String getName() {
		return name;
	}

	/**
	 * 设置资源名称
	 * 
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}
}
